<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<div class="pageHeader">
    <form id="pagerForm" action="${ctx }/user/list" method="post"
          onsubmit="return navTabSearch(this);">
        <div class="searchBar">
            <table class="searchContent">
                <tbody>
                <!--分页输入-->
                <input type="hidden" name="pageNum" value="1"/>
                <input type="hidden" name="numPerPage" value="${pageParam.pageSize eq null ? 20 : pageParam.pageSize}"/>
                <tr>
                    <td>
                        用户ID：<input name="userId" value="${pageParam.userId}"/>
                    </td>
                    <td>
                        <label>用户类型：</label>
                        <select name="userType" maxlength="50">
                            <option value="">
                                未选择
                            </option>
                            <option value="1"
                                    <c:if test="${pageParam.userType eq 1}">selected="selected"</c:if>>学生
                            </option>
                            <option value="2"
                                    <c:if test="${pageParam.userType eq 2}">selected="selected"</c:if>>老师
                            </option>
                        </select>
                    </td>
                    <td>
                        昵称：<input name="nickname" value="${pageParam.nickname}"/>
                    </td>
                    <td>
                        手机号：<input name="mobile" value="${pageParam.mobile}"/>
                    </td>
                    <td>
                        邮箱：<input name="email" value="${pageParam.email}"/>
                    </td>

                </tr>
                </tbody>
            </table>
            <div class="subBar">
                <ul>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit">搜索</button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </form>
</div>

<div class="panelBar">
    <ul class="toolBar">
        <li>
            <a class="add" href="${ctx }/user/addBefore" target="dialog" mask="true" rel="user_add"
               height="450" width="500" title="新增用户">
                <span>新增用户</span>
            </a>
        </li>
    </ul>
</div>
<table class="table" width="2000" layoutH="137">
    <thead>
    <tr>
        <th style="width:5%">用户ID</th>
        <th style="width:5%">用户类型</th>
        <th style="width:5%">昵称</th>
        <th style="width:5%">手机号</th>
        <th style="width:5%">邮箱</th>
        <th style="width:5%">性别</th>
        <th style="width:5%">生日</th>
        <th style="width:5%">生日GMT时间</th>
        <th style="width:5%">时区</th>
        <th style="width:5%">CP积分</th>
        <th style="width:5%">国家</th>
        <th style="width:5%">职业</th>
        <th style="width:5%">注册时间</th>
        <th style="width:5%">上次登录时间</th>
        <th style="width:5%">操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${records}" var="record" varStatus="status">
        <tr>
            <td>
                <div>${record.userId}</div>
            </td>
            <td>
                <c:if test="${record.userType == 1 }">
                    <div>学生</div>
                </c:if>
                <c:if test="${record.userType == 2 }">
                    <div>老师</div>
                </c:if>
            </td>
            <td>
                <div>${record.nickname}</div>
            </td>
            <td>
                <div>${record.mobile}</div>
            </td>
            <td>
                <div>${record.email}</div>
            </td>
            <td>
                <c:if test="${record.gender == 0 }">
                    <div>女</div>
                </c:if>
                <c:if test="${record.gender == 1 }">
                    <div>男</div>
                </c:if>
            </td>
            <td><fmt:formatDate value="${record.birthday}" type="both"
                                pattern="yyyy-MM-dd"/></td>
            <td>
                <div>${record.birthdayGmt}</div>
            </td>
            <td>
                <div>${record.timezone}</div>
            </td>
            <td>
                <div>${record.cpScore}</div>
            </td>
            <td>
                <div>${record.country}</div>
            </td>
            <td>
                <div>${record.occupation}</div>
            </td>
            <td><fmt:formatDate value="${record.registerTime}" type="both"
                                pattern="yyyy-MM-dd HH:mm:ss"/></td>
            <td><fmt:formatDate value="${record.lastLoginTime}" type="both"
                                pattern="yyyy-MM-dd HH:mm:ss"/></td>
            <td>
                <a href="${ctx }/user/updateBefore/${record.userId}.do" target="dialog" mask="true"
                   rel="user_edit_view"
                   resizable="false" maxable="false" minable="false"
                   title="编辑版本" height="450" width="500" class="btnEdit">编辑用户</a>
            </td>
    </c:forEach>
    </tbody>
</table>

<!--分页页面组件 -->
<div class="panelBar">
    <div class="pages">
        <span>每页</span>
        <select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
            <option value="20" ${pageParam.pageSize eq 20 ? 'selected':''}>20</option>
            <option value="50" ${pageParam.pageSize eq 50 ? 'selected':''}>50</option>
            <option value="100" ${pageParam.pageSize eq 100 ? 'selected':''}>100</option>
            <option value="200" ${pageParam.pageSize eq 200 ? 'selected':''}>200</option>
        </select>
        <span>条 , 总记录数: ${pageParam.totalCount} 条</span>
    </div>
    <div class="pagination" targetType="navTab" totalCount="${pageParam.totalCount}" numPerPage="${pageParam.pageSize}"
         pageNumShown="10" currentPage="${pageParam.pageNum}"></div>
</div>